import request from '@/utils/request';

export async function getRiskData(params) {
  return request(`/fss/RiskManage/Option`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(),
  });
}

// 期权获取2
/* 返回说明«List«FundRiskOptionInfoModel»» {
code (integer, optional): 成功标识；1：成功；0:失败 ,
data (Array[FundRiskOptionInfoModel], optional),
message (string, optional): 错误信息
}
FundRiskOptionInfoModel {
addtime (string, optional): 添加时间 ,
attribute (string, optional): 类型ETF//高权利金 ,
costprice (number, optional): 成本价 ,
costroyalty (number, optional): 初始权利金 ,
date (string, optional),
expiry (string, optional): 到期日 ,
fundtype (integer, optional): 基金名称 ,
id (integer, optional),
mark (string, optional): 标记 ,
name (string, optional): 期权代码 ,
nowoptionprice (number, optional): 当前期权价格 ,
nowprice (number, optional): 当前价格 ,
nowroyalty (number, optional): 当前权利金 ,
positionpercent (number, optional): 仓位比例 ,
profit (number, optional): 盈亏 ,
profitpercent (number, optional): 盈亏百分比 ,
reportdate (string, optional): 财报日 ,
risklevel (integer, optional): 风险等级 ,
royaltypercent (number, optional): 权利金剩余比例 ,
stock (string, optional),
stocknumber (integer, optional): 股数 ,
strikepercent (number, optional): 距离执行价幅度 ,
strikeprice (number, optional): 执行价 ,
todayprofit (number, optional): 今日盈亏 ,
trade (string, optional): 行业 ,
tradedate (string, optional): 买入时间 ,
tradepercent (number, optional): 行业占比 ,
type (integer, optional)
} */
export async function getShareOptionRiskDataTwo() {
  return request(`/fss/RiskManage/Fund2Option`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: {},
  });
}

// 期权获取4
export async function getShareOptionRiskDataFour() {
  return request(`/fss/RiskManage/Fund4Option`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: {},
  });
}
// 期权修改
/* FundRiskOptionInfoModel {
mark (string, optional): 标记 ,
risklevel (integer, optional): 风险等级 ,
} */
export async function changeShareOptionRiskData(params) {
  return request(`/fss/RiskManage/OptionUpdate`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(params),
  });
}

// 股票获取2
/* 返回说明«List«FundRiskOptionInfoModel»» {
  code (integer, optional): 成功标识；1：成功；0:失败 ,
  data (Array[FundRiskOptionInfoModel], optional),
  message (string, optional): 错误信息
}
FundRiskStockInfoModel {
  addtime (string, optional): 交易时间 ,
  alertpercent (number, optional): 告警百分比 ,
  costprice (number, optional): 成本价 ,
  date (string, optional),
  dscription (string, optional): 描述 ,
  fundtype (integer, optional),
  id (integer, optional),
  lostprice (number, optional): 止损价格 ,
  mark (string, optional): 标记 ,
  marketvalue (number, optional): 市值 ,
  nowprice (number, optional): 当前价格 ,
  positionpercent (number, optional): 持仓占比 ,
  profit (number, optional): 盈亏 ,
  profitpercent (number, optional): 盈亏比例 ,
  reportdate (string, optional): 财报日 ,
  risklevel (integer, optional): 风控等级 ,
  sellcallcount (integer, optional),
  sellputcount (integer, optional),
  stockcode (string, optional): 股票代码 ,
  stocknumber (integer, optional): 数量 ,
  todayprofit (number, optional): 今日盈亏 ,
  trade (string, optional): 行业 ,
  tradepercent (number, optional): 行业占比
} */
export async function getStockRiskDataTwo(params) {
  return request(`/fss/RiskManage/Fund2Stock`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(params),
  });
}
// 股票获取4
export async function getStockRiskDataFour(params) {
  return request(`/fss/RiskManage/Fund4Stock`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(params),
  });
}
// 股票修改
/* FundRiskStockInfoModel {
addtime (string, optional): 交易时间 ,
alertpercent (number, optional): 告警百分比 ,
costprice (number, optional): 成本价 ,
date (string, optional),
dscription (string, optional): 描述 ,
fundtype (integer, optional),
id (integer, optional),
lostprice (number, optional): 止损价格 ,
mark (string, optional): 标记 ,
marketvalue (number, optional): 市值 ,
nowprice (number, optional): 当前价格 ,
positionpercent (number, optional): 持仓占比 ,
profit (number, optional): 盈亏 ,
profitpercent (number, optional): 盈亏比例 ,
reportdate (string, optional): 财报日 ,
risklevel (integer, optional): 风控等级 ,
sellcallcount (integer, optional),
sellputcount (integer, optional),
stockcode (string, optional): 股票代码 ,
stocknumber (integer, optional): 数量 ,
todayprofit (number, optional): 今日盈亏 ,
trade (string, optional): 行业 ,
tradepercent (number, optional): 行业占比
} */
export async function changeStockRiskData(params) {
  return request(`/fss/RiskManage/StockUpdate`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(params),
  });
}

export async function getWorstStockOptionTable(params) {
  return request(`/fss/Position/WorstStockOptionTable?type=` + params, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
